#include<bits/stdc++.h>
using namespace std;
int countdigit(int n,int d)
{
	int cnt=0;
	while(n)
	{
		if(n%10==d) cnt++;
		n=n/10;
	}
	return cnt;
}
int main()
{
	int x,y;
	cin>>x>>y;
	printf("Number of digit %d is %d",y,countdigit(x,y));
    return 0;
}
